var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    jianyiState: false,
    statep: 2, //0  生成  1 未解读  2 已解读
    retult: [{
      names: "血常规",
      open: false,
      list: [{
          text: "白细胞计数（WBC）",
          val: "11.97",
          abnormal: 1
        },
        {
          text: "中性粒细胞百分比（%NEUT）",
          val: "8.97",
          abnormal: 1
        },
        {
          text: "嗜酸细胞百分比（%EOS）",
          val: "4.8",
          abnormal: 0
        },
      ]
    }, {
      names: "尿常规",
      open: false,
      list: [{
          text: "葡萄糖（GLU）（阴性）",
          val: "阴性",
          abnormal: 0
        },
        {
          text: "比重（SG）（1.005-1.030）",
          val: "1.001",
          abnormal: 1
        },
        {
          text: "尿胆原定性（UBG）（阴性  umol/L）",
          val: "阴性",
          abnormal: 0
        },
      ]
    }],
    unscramble: [{
      names: "李雪晴",
      imgicon: "../../../images/eqcordnew.png",
      site: "山西省人民医院",
      professional: "副主任医师",
      times: "昨天23:00",
      people: 230,
      mess: "您好，因为血常规的主要参考项目是，白细胞和红 细胞，血小板的数目以及血红蛋白的数值。指导意 见上述的描述显示白细胞减低，其余问"
    }, ]
  },
  big_img: function (e) {
    var url = e.currentTarget.dataset.url;
    var imglist = e.currentTarget.dataset.imglist;
    console.log(url)
    console.log(imglist)
    wx.previewImage({
      urls: imglist,
      current: url
    })
  },
  showjainyicont: function (e) {
    this.setData({
      jianyiState: !this.data.jianyiState
    })
  },
  itemshow(e) {
    let dex = e.currentTarget.dataset.dex;
    var type = e.currentTarget.dataset.type;
    var content = this.data.content;
    var addproject = this.data.addproject;

    if (type == 1) {
      content[dex].open = !content[dex].open
    } else if (type == 2) {
      addproject[dex].open = !addproject[dex].open
    }
    console.log(content)
    this.setData({
      content,
      addproject,
    })
  },



  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    var bgc = wx.getStorageSync('color')

    var id = options.id
    var wzid = options.wzid
    var zid = options.zid
    var back_orser = options.back_orser
    that.setData({
      id: id,
      wzid: wzid,
      zid: zid,
      back_orser: back_orser
    })
    if (options.ifzj) {
      var ifzj = options.ifzj
      that.setData({
        ifzj: ifzj
      })
    }
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    var id = options.id
    app.util.request({
      'url': 'entry/wxapp/tijian.oderinfo',
      data: {
        id: id
      },
      success: function (res) {
        console.log(res)
        that.setData({
          detail: res.data,
          content: res.data.content,
          addproject: res.data.addproject,
          zid: res.data.zid,
          doc: res.data.zj,
          result:res.data.data
        })
      }
    })
  },
  scanCode() {
    var _this = this;
    // 允许从相机和相册扫码
    wx.scanCode({
      success: (res) => {
        var result = res.result;
        _this.setData({
          result: result,
        })
      }
    })
  },
  tijianbtn(e) {
    var id = e.currentTarget.dataset.id
    // wx.navigateTo({
    //   url: '/hyb_yl/userCommunicate/pages/changeDoctor/changeDoctor?id=' + id + '&key_words=tijianjiedu&inquiry=5&ser_key=tijianjiedu&long=tijian',
    // })
    wx.navigateTo({
      url: '/hyb_yl/userCommunicate/pages/changeDoctor/changeDoctor?inquiry=5&long=undefined&ser_key=tijianjiedu&tid=' + id,
    })
  },


  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  jiedu(e) {
    var that = this
    var back_orser = that.data.back_orser
    var zid = that.data.zid
    var wzid = that.data.wzid
    var id = that.data.id
    wx.navigateTo({
      url: '/hyb_yl/zhuanjiasubpages/pages/edit/edit?back_orser=' + back_orser + '&zid=' + zid + '&id=' + id + '&wzid=' + wzid + '&key_words=tijianjiedu',
    })
  }
})